\(\int x (a+b \csc (c+d x^2))^2 \, dx\) [12]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 16, antiderivative size = 45 \[ \int x \left (a+b \csc \left (c+d x^2\right )\right )^2 \, dx=\frac {a^2 x^2}{2}-\frac {a b \text {arctanh}\left (\cos \left (c+d x^2\right )\right )}{d}-\frac {b^2 \cot \left (c+d x^2\right )}{2 d} \]

[Out]

1/2*a^2*x^2-a*b*arctanh(cos(d*x^2+c))/d-1/2*b^2*cot(d*x^2+c)/d

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 45, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.312, Rules used = {4290, 3858, 3855, 3852, 8} \[ \int x \left (a+b \csc \left (c+d x^2\right )\right )^2 \, dx=\frac {a^2 x^2}{2}-\frac {a b \text {arctanh}\left (\cos \left (c+d x^2\right )\right )}{d}-\frac {b^2 \cot \left (c+d x^2\right )}{2 d} \]

[In]

Int[x*(a + b*Csc[c + d*x^2])^2,x]

[Out]

(a^2*x^2)/2 - (a*b*ArcTanh[Cos[c + d*x^2]])/d - (b^2*Cot[c + d*x^2])/(2*d)

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3852

Int[csc[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Dist[-d^(-1), Subst[Int[ExpandIntegrand[(1 + x^2)^(n/2 - 1), x]
, x], x, Cot[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[n/2, 0]

Rule 3855

Int[csc[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-ArcTanh[Cos[c + d*x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3858

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^2, x_Symbol] :> Simp[a^2*x, x] + (Dist[2*a*b, Int[Csc[c + d*x], x],
 x] + Dist[b^2, Int[Csc[c + d*x]^2, x], x]) /; FreeQ[{a, b, c, d}, x]

Rule 4290

Int[((a_.) + Csc[(c_.) + (d_.)*(x_)^(n_)]*(b_.))^(p_.)*(x_)^(m_.), x_Symbol] :> Dist[1/n, Subst[Int[x^(Simplif
y[(m + 1)/n] - 1)*(a + b*Csc[c + d*x])^p, x], x, x^n], x] /; FreeQ[{a, b, c, d, m, n, p}, x] && IGtQ[Simplify[
(m + 1)/n], 0] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = \frac {1}{2} \text {Subst}\left (\int (a+b \csc (c+d x))^2 \, dx,x,x^2\right ) \\ & = \frac {a^2 x^2}{2}+(a b) \text {Subst}\left (\int \csc (c+d x) \, dx,x,x^2\right )+\frac {1}{2} b^2 \text {Subst}\left (\int \csc ^2(c+d x) \, dx,x,x^2\right ) \\ & = \frac {a^2 x^2}{2}-\frac {a b \text {arctanh}\left (\cos \left (c+d x^2\right )\right )}{d}-\frac {b^2 \text {Subst}\left (\int 1 \, dx,x,\cot \left (c+d x^2\right )\right )}{2 d} \\ & = \frac {a^2 x^2}{2}-\frac {a b \text {arctanh}\left (\cos \left (c+d x^2\right )\right )}{d}-\frac {b^2 \cot \left (c+d x^2\right )}{2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.00 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.91 \[ \int x \left (a+b \csc \left (c+d x^2\right )\right )^2 \, dx=\frac {-b^2 \cot \left (\frac {1}{2} \left (c+d x^2\right )\right )+2 a \left (a c+a d x^2-2 b \log \left (\cos \left (\frac {1}{2} \left (c+d x^2\right )\right )\right )+2 b \log \left (\sin \left (\frac {1}{2} \left (c+d x^2\right )\right )\right )\right )+b^2 \tan \left (\frac {1}{2} \left (c+d x^2\right )\right )}{4 d} \]

[In]

Integrate[x*(a + b*Csc[c + d*x^2])^2,x]

[Out]

(-(b^2*Cot[(c + d*x^2)/2]) + 2*a*(a*c + a*d*x^2 - 2*b*Log[Cos[(c + d*x^2)/2]] + 2*b*Log[Sin[(c + d*x^2)/2]]) +
 b^2*Tan[(c + d*x^2)/2])/(4*d)

Maple [A] (verified)

Time = 0.63 (sec) , antiderivative size = 51, normalized size of antiderivative = 1.13

method result size
parts \(\frac {a^{2} x^{2}}{2}-\frac {b^{2} \cot \left (d \,x^{2}+c \right )}{2 d}-\frac {a b \ln \left (\csc \left (d \,x^{2}+c \right )+\cot \left (d \,x^{2}+c \right )\right )}{d}\) \(51\)
derivativedivides \(\frac {a^{2} \left (d \,x^{2}+c \right )+2 a b \ln \left (\csc \left (d \,x^{2}+c \right )-\cot \left (d \,x^{2}+c \right )\right )-b^{2} \cot \left (d \,x^{2}+c \right )}{2 d}\) \(55\)
default \(\frac {a^{2} \left (d \,x^{2}+c \right )+2 a b \ln \left (\csc \left (d \,x^{2}+c \right )-\cot \left (d \,x^{2}+c \right )\right )-b^{2} \cot \left (d \,x^{2}+c \right )}{2 d}\) \(55\)
parallelrisch \(\frac {2 a^{2} x^{2} d -\cot \left (\frac {d \,x^{2}}{2}+\frac {c}{2}\right ) b^{2}+\tan \left (\frac {d \,x^{2}}{2}+\frac {c}{2}\right ) b^{2}+4 \ln \left (\tan \left (\frac {d \,x^{2}}{2}+\frac {c}{2}\right )\right ) a b}{4 d}\) \(63\)
risch \(\frac {a^{2} x^{2}}{2}-\frac {i b^{2}}{d \left ({\mathrm e}^{2 i \left (d \,x^{2}+c \right )}-1\right )}+\frac {a b \ln \left ({\mathrm e}^{i \left (d \,x^{2}+c \right )}-1\right )}{d}-\frac {a b \ln \left ({\mathrm e}^{i \left (d \,x^{2}+c \right )}+1\right )}{d}\) \(75\)
norman \(\frac {-\frac {b^{2}}{4 d}+\frac {a^{2} x^{2} \tan \left (\frac {d \,x^{2}}{2}+\frac {c}{2}\right )}{2}+\frac {b^{2} \tan \left (\frac {d \,x^{2}}{2}+\frac {c}{2}\right )^{2}}{4 d}}{\tan \left (\frac {d \,x^{2}}{2}+\frac {c}{2}\right )}+\frac {a b \ln \left (\tan \left (\frac {d \,x^{2}}{2}+\frac {c}{2}\right )\right )}{d}\) \(83\)

[In]

int(x*(a+b*csc(d*x^2+c))^2,x,method=_RETURNVERBOSE)

[Out]

1/2*a^2*x^2-1/2*b^2*cot(d*x^2+c)/d-a*b/d*ln(csc(d*x^2+c)+cot(d*x^2+c))

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 94 vs. \(2 (41) = 82\).

Time = 0.26 (sec) , antiderivative size = 94, normalized size of antiderivative = 2.09 \[ \int x \left (a+b \csc \left (c+d x^2\right )\right )^2 \, dx=\frac {a^{2} d x^{2} \sin \left (d x^{2} + c\right ) - a b \log \left (\frac {1}{2} \, \cos \left (d x^{2} + c\right ) + \frac {1}{2}\right ) \sin \left (d x^{2} + c\right ) + a b \log \left (-\frac {1}{2} \, \cos \left (d x^{2} + c\right ) + \frac {1}{2}\right ) \sin \left (d x^{2} + c\right ) - b^{2} \cos \left (d x^{2} + c\right )}{2 \, d \sin \left (d x^{2} + c\right )} \]

[In]

integrate(x*(a+b*csc(d*x^2+c))^2,x, algorithm="fricas")

[Out]

1/2*(a^2*d*x^2*sin(d*x^2 + c) - a*b*log(1/2*cos(d*x^2 + c) + 1/2)*sin(d*x^2 + c) + a*b*log(-1/2*cos(d*x^2 + c)
 + 1/2)*sin(d*x^2 + c) - b^2*cos(d*x^2 + c))/(d*sin(d*x^2 + c))

Sympy [F]

\[ \int x \left (a+b \csc \left (c+d x^2\right )\right )^2 \, dx=\int x \left (a + b \csc {\left (c + d x^{2} \right )}\right )^{2}\, dx \]

[In]

integrate(x*(a+b*csc(d*x**2+c))**2,x)

[Out]

Integral(x*(a + b*csc(c + d*x**2))**2, x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 98 vs. \(2 (41) = 82\).

Time = 0.19 (sec) , antiderivative size = 98, normalized size of antiderivative = 2.18 \[ \int x \left (a+b \csc \left (c+d x^2\right )\right )^2 \, dx=\frac {1}{2} \, a^{2} x^{2} - \frac {a b \log \left (\cot \left (d x^{2} + c\right ) + \csc \left (d x^{2} + c\right )\right )}{d} - \frac {b^{2} \sin \left (2 \, d x^{2} + 2 \, c\right )}{d \cos \left (2 \, d x^{2} + 2 \, c\right )^{2} + d \sin \left (2 \, d x^{2} + 2 \, c\right )^{2} - 2 \, d \cos \left (2 \, d x^{2} + 2 \, c\right ) + d} \]

[In]

integrate(x*(a+b*csc(d*x^2+c))^2,x, algorithm="maxima")

[Out]

1/2*a^2*x^2 - a*b*log(cot(d*x^2 + c) + csc(d*x^2 + c))/d - b^2*sin(2*d*x^2 + 2*c)/(d*cos(2*d*x^2 + 2*c)^2 + d*
sin(2*d*x^2 + 2*c)^2 - 2*d*cos(2*d*x^2 + 2*c) + d)

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 84 vs. \(2 (41) = 82\).

Time = 0.27 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.87 \[ \int x \left (a+b \csc \left (c+d x^2\right )\right )^2 \, dx=\frac {2 \, {\left (d x^{2} + c\right )} a^{2} + 4 \, a b \log \left ({\left | \tan \left (\frac {1}{2} \, d x^{2} + \frac {1}{2} \, c\right ) \right |}\right ) + b^{2} \tan \left (\frac {1}{2} \, d x^{2} + \frac {1}{2} \, c\right ) - \frac {4 \, a b \tan \left (\frac {1}{2} \, d x^{2} + \frac {1}{2} \, c\right ) + b^{2}}{\tan \left (\frac {1}{2} \, d x^{2} + \frac {1}{2} \, c\right )}}{4 \, d} \]

[In]

integrate(x*(a+b*csc(d*x^2+c))^2,x, algorithm="giac")

[Out]

1/4*(2*(d*x^2 + c)*a^2 + 4*a*b*log(abs(tan(1/2*d*x^2 + 1/2*c))) + b^2*tan(1/2*d*x^2 + 1/2*c) - (4*a*b*tan(1/2*
d*x^2 + 1/2*c) + b^2)/tan(1/2*d*x^2 + 1/2*c))/d

Mupad [B] (verification not implemented)

Time = 18.32 (sec) , antiderivative size = 102, normalized size of antiderivative = 2.27 \[ \int x \left (a+b \csc \left (c+d x^2\right )\right )^2 \, dx=\frac {a^2\,x^2}{2}-\frac {b^2\,1{}\mathrm {i}}{d\,\left ({\mathrm {e}}^{2{}\mathrm {i}\,d\,x^2+c\,2{}\mathrm {i}}-1\right )}-\frac {a\,b\,\ln \left (-a\,b\,x\,4{}\mathrm {i}-a\,b\,x\,{\mathrm {e}}^{d\,x^2\,1{}\mathrm {i}}\,{\mathrm {e}}^{c\,1{}\mathrm {i}}\,4{}\mathrm {i}\right )}{d}+\frac {a\,b\,\ln \left (a\,b\,x\,4{}\mathrm {i}-a\,b\,x\,{\mathrm {e}}^{d\,x^2\,1{}\mathrm {i}}\,{\mathrm {e}}^{c\,1{}\mathrm {i}}\,4{}\mathrm {i}\right )}{d} \]

[In]

int(x*(a + b/sin(c + d*x^2))^2,x)

[Out]

(a^2*x^2)/2 - (b^2*1i)/(d*(exp(c*2i + d*x^2*2i) - 1)) - (a*b*log(- a*b*x*4i - a*b*x*exp(d*x^2*1i)*exp(c*1i)*4i
))/d + (a*b*log(a*b*x*4i - a*b*x*exp(d*x^2*1i)*exp(c*1i)*4i))/d